<template>
	<public-dialog
		:title="'查看项目明细'"
		:width="'80%'"
		:footerButton="false"
		v-model:visible="visible"
	>
		<tableIndex
			:tableData="tableData"
			:tableHead="tableHead"
			ref="tableIndexRef"
			:isPaging="false"
			:isIndex="true"
			:isSelection="false"
			:notSearch="true"
			:isRadio="false"
			:height="300"
			:page="page"
		>
		</tableIndex>
	</public-dialog>
</template>

<script setup>
import { ref, reactive } from "vue";
import PublicDialog from "@/components/PublicDialog.vue";
import tableIndex from "@/components/table/index.vue";
import { useRouter } from "vue-router";
import { projectApi } from "@/api/project";
let router = useRouter();
const state = reactive({});
const visible = ref(false);
const page = reactive({
	page: 1,
	pageSize: 10,
	total: 0,
});

const onConfirm = () => {};
let tableData = ref([{}]);
let tableHead = ref([
	{
		prop: "projectName",
		label: "关联项目名称",
		minWidth: "120",
	},
	{
		prop: "projectSetId",
		label: "项目集编码",
		minWidth: "100",
	},
	{
		prop: "projectId",
		label: "项目编号",
	},
	{
		prop: "typeName",
		label: "项目分类",
	},
	{
		prop: "streetName",
    label: "项目位置(所属街道)",
    minWidth: "150",
	},
	{
		prop: "projectAmount",
    label: "拟计划总投额",
    minWidth: "120",
	},
	{
		prop: "actualTotalInvestment",
    label: "实际累计总投额",
    minWidth: "130",
	},
	{
		prop: "projectCategory",
		label: "项目类型",
		formatter: (value) => {
			return value == 1 ? "公司自建" : value == 2 ? "政府投资" : "代建项目";
		},
	},
	{
		prop: "prepareStatus",
		label: "项目状态",
		formatter: (value) => {
			return value == -1 ? "预备项目" : "已立项项目";
		},
	},
	{
		prop: "responsibleDepartmentName",
    label: "项目立项部门",
    minWidth: "120",
	},
	{
		prop: "createTime",
    label: "项目创建时间",
    minWidth: "120",
	},
]);

const toPathHandel = (row) => {

	router.push({
		path: `/constructionProjectManage/projectmanagement/components/updateIndex/type=2&edit=${row.projectSetId}`,
	});
};

const open = (row) => {
	visible.value = true;
	getPage(row.projectSetId);
};

//分页接口请求
const getPage = (e) => {
	projectApi.getProjectInfo(e).then((res) => {
		if (res.code == 200) {
			tableData.value = res.data;
			// page.total = res.data.totalSize;
			console.log(tableData);
		}
	});
};

defineExpose({
	open,
});
</script>
<style lang="scss" scoped></style>
